require("./CoursePPTEdit.scss")

require("../../both/base")

class CoursePPTEdit extends React.Component {
    constructor(props){
        super(props)
    }

    componentDidMount(){
        PDFJS.getDocument('/p_dist/upload/1.pdf').then((pdf) => {
            pdf.getPage(1).then((page) => {
                var scale = 0.8;
                var viewport = page.getViewport(scale);

                var canvas = document.getElementById('the_pdf');
                var context = canvas.getContext('2d');
                canvas.height = viewport.height;
                canvas.width = viewport.width;

                var renderContext = {
                    canvasContext: context,
                    viewport: viewport
                };
                page.render(renderContext);
            })
        })

    }

    render(){
        return (
            // todo : pdf 展示插件
            <div className="course_ppt_edit_wr bln">
                课件管理开发中
                <div className="canvasWrapper">
                    <canvas id="the_pdf"></canvas>
                </div>
            </div>
        )
    }
}

export default CoursePPTEdit